﻿@model Sidvall.LogManager.Web.Host.Models.IndexModel
@{
	ViewBag.Title = "Startsidan";
}

<div class="jumbotron">
	<h1>Sidvall.LogManager Web API</h1>
</div>

<div class="row">
	<div class="col-md-12">
		<table>
			<thead>

			</thead>
			<tr>
				<td style="font-weight:900">Resource</td>
				@foreach (var action in Model.Actions)
				{
					<td style="font-weight:900">@action</td>
				}
			</tr>
			@foreach (var resource in Model.Resources)
			{
				<tr>
					<td style="font-weight:900">@resource</td>
				@foreach (var action in Model.Actions)
				{
					var result = Model.GetResult(resource, action);
					var className = "";
					switch (result.AccessLevel)
					{
						case Sidvall.Security.ResourceItemAccessLevel.Public:
							className = "result_public";
							break;
						case Sidvall.Security.ResourceItemAccessLevel.Protected:
							className = "result_authenticated";
							break;
						case Sidvall.Security.ResourceItemAccessLevel.None:
							className = "result_none";
							break;
						default:
							break;
					}
					<td class="@className" style="font-weight:normal">
						@Html.Raw(result.Description)
					</td>
				}
				</tr>
			}
		</table>
	</div>
</div>